﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Net.Mail;
using System.Net;

/// <summary>
/// Summary description for Messenger
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class Messenger : System.Web.Services.WebService {

    public Messenger () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public void SendEmail(string UserName, string Password, string SenderDisplayName, string To, string Subject, string Message)
    {
        if (UserName == "ce" && UserName == "ce")
        {
            
            MailMessage email = new MailMessage();
            email.From = new MailAddress("orhan.aykut@karbel.com",SenderDisplayName );

            email.Subject = Subject;
            email.Body = Message;
            email.IsBodyHtml = true;
            email.To.Add(To);


            using (SmtpClient emailClient = new SmtpClient("Karbelnt"))
            {
                emailClient.Credentials = new NetworkCredential("orhan.aykut", "oa1034");
                emailClient.Send(email);
            }
        }
    }
    
}
